package com.methods;
/**
 * Rectangle类
 * 2017/8/20.
 * @author Erik
 * @version 0.1
 * @since JDK1.8
 * @see com.methods.Shape
 */
public class Rectangle extends Shape {
    private double length;
    private double width;

    public Rectangle(){}

    /**
     * 双参构造
     * 初始化所有成员
     * @param length    长度
     * @param width     宽度
     */
    public Rectangle(double length,double width){
        this.setLength(length);
        this.setWidth(width);
    }

    //getters
    public double getLength() {
        return length;
    }

    public double getWidth() {
        return width;
    }
//setters
    public void setLength(double length) {
        this.length = length;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    @Override
    public void area() {
        System.out.println("矩形面积为:"+(this.getLength()*this.getWidth()));
    }
}
